//
//  MyLineTableViewCell.m
//  HarmonizePub
//
//  Created by rzhy on 2016/10/10.
//  Copyright © 2016年 Zy. All rights reserved.
//

#import "MyLineTableViewCell.h"
#import "Config.h"

@interface MyLineTableViewCell ()

@property (weak, nonatomic) IBOutlet UIView *mainView;
@property (weak, nonatomic) IBOutlet UILabel *titleLabel;
@property (weak, nonatomic) IBOutlet UILabel *currentNumLabel;
@property (weak, nonatomic) IBOutlet UILabel *myNumLabel;
@property (weak, nonatomic) IBOutlet UILabel *nameLabel;
@property (weak, nonatomic) IBOutlet UILabel *depNameLabel;

@end

@implementation MyLineTableViewCell

+ (NSString *)registerName {
    return @"MyLineTableViewCell";
}

+ (CGFloat)cellHeight {
    return 130.0f;
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    self.mainView.layer.cornerRadius = 5.0f;
    self.mainView.layer.masksToBounds = YES;
//    self.mainView.layer.borderWidth = 1.0f;
//    self.mainView.layer.borderColor = RGBColor(230, 230, 230).CGColor;
    self.mainView.layer.shadowColor = [UIColor lightGrayColor].CGColor;
    self.mainView.layer.shadowOffset = CGSizeMake(2.0f, 2.0f);
    self.mainView.layer.shadowOpacity = 0.5f;
}

- (void)setCellShowDataWithDataDictionary:(NSDictionary *)dataDict {
//    XHLog(@"dataDict: %@", dataDict);
    [self setTitleWithDqjh:dataDict[@"dqjh"] wdhs:dataDict[@"wdhs"]];
    [self setCurrentNumber:dataDict[@"dqjh"]];
    [self setMyNumber:dataDict[@"wdhs"]];
    self.nameLabel.text     = [NSString stringWithFormat:@"%@(%@)", dataDict[@"brxm"], dataDict[@"jzkh"]];
    self.depNameLabel.text  = dataDict[@"ksmc"];
}

- (void)setTitleWithDqjh:(NSString *)dqjh wdhs:(NSString *)wdhs {
    NSInteger num1 = [dqjh integerValue];
    NSInteger num2 = [wdhs integerValue];
    NSInteger num = num2 - num1;
    if (num < 0) num = 0;
    self.titleLabel.text = [NSString stringWithFormat:@"您的前面还有%ld人等候就诊", (long)num];
}

- (void)setCurrentNumber:(NSString *)currentNum {
    currentNum = [currentNum stringByAppendingString:@"号"];
    self.currentNumLabel.text = currentNum;
}

- (void)setMyNumber:(NSString *)myNum {
    myNum = [myNum stringByAppendingString:@"号"];
    self.myNumLabel.text = myNum;
}

@end
